import time
import gradio as gr


def trim_words(words, lens):
    trimmed_words = []
    time.sleep(2)
    for w, l in zip(words, lens):
        trimmed_words.append(w[:int(l)])
    return [trimmed_words]


demo = gr.Interface(trim_words, ["textbox", "number"], ["textbox"], batch=True, max_batch_size=16)
# demo.queue(concurrency_count=3)
demo.queue()
demo.launch(server_name='0.0.0.0', server_port=7776, share=True)
